﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _2_SerialTest
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            //添加COM端口
            Port_cob.Items.Add("COM4");
            Port_cob.Items.Add("COM5");
            //初始发送框内容
            Send_txt.Text = "我是发送框";
            //初始接收框内容
            Recrive_rxt.Text = "我是接收框";
        }

        private void Send_btn_Click(object sender, EventArgs e)
        {
            //如果发送框为空，则不发送
            if (Send_txt.Text != "")
            {
                Recrive_rxt.AppendText(Send_txt.Text);
            }
            else
            {
                MessageBox.Show("请先输入发送数据！", "提示");
            }
        }
    }
}
